/*
 *  JDiv - API for Multimedia Application
 *  http://jdiv.sourceforge.net 
 *  ------------------------------------
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */

package com.jdiv.internalList;

import java.util.ArrayList;

import com.jdiv.internalClasses.JDivDisposable;

public class JDivListDispose {
	    
		// Lista objetos para cargar
		public ArrayList<JDivDisposable> listLoad;
		
		// Lista objetos para descargar
		public ArrayList<JDivDisposable> listDispose;
		
		public JDivListDispose(){
			listLoad    = new ArrayList<JDivDisposable>();
			listDispose = new ArrayList<JDivDisposable>();
		}
		
		public void dispose(){
			listLoad.clear();
			listDispose.clear();
		}
		
		// Cargamos los objetos nuevos: Imagenes, Efectos, Fuentes, Skins
		
		public void load(){
		 if(listLoad.size() > 0 ){
			for( int i = 0; i < listLoad.size(); i++ )
				if( listLoad.get(i) != null )
					listLoad.get(i).load();
			
			listLoad.clear();
		 }
		}
		
		// Descargamos los objetos: Imagenes, Efectos, Fuentes, Skins
		public void unLoad(){
		 if( listDispose.size() > 0 ){
				for( int i = 0; i < listDispose.size(); i++ )
					if( listDispose.get(i) != null )
					 listDispose.get(i).dispose();
				
				listDispose.clear();
		 }
		}

}
